import 'package:flutter/cupertino.dart';
import 'package:flutter_app/openeye/viewmodel/home_page_viewmodel.dart';
import 'package:flutter_app/openeye/widget/home/banner_widget.dart';
import 'package:flutter_app/openeye/widget/loading_state_widget.dart';
import 'package:flutter_app/openeye/widget/provider_widget.dart';

class HomeBodyPage extends StatefulWidget {
  const HomeBodyPage({Key? key}) : super(key: key);

  @override
  _HomeBodyPageState createState() => _HomeBodyPageState();
}
class _HomeBodyPageState extends State<HomeBodyPage>
    with AutomaticKeepAliveClientMixin {

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return ProviderWidget<HomePageViewModel>(
        model: HomePageViewModel(),
        onModelInit: (model) => model.refresh(),
        builder: (context, model, child,) {
          return LoadingStateWidget(viewState: model.viewState,
            retry: model.retry,
            child: _banner(model),);
        });
  }
  @override
  bool get wantKeepAlive => true;

  _banner(HomePageViewModel model) {
    return Container(
      height: 200, padding: const EdgeInsets.only(left: 15, top: 15, right: 15),
      child: ClipRRect(borderRadius: BorderRadius.circular(4),
        // child:BannerWidget(model: model,),),
        child:Text("这里应该有一个banner"),),
    );
  }


}
